#!/bin/bash
#
### BEGIN INIT INFO
# Provides: docserver
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Doc Server
#
### END INIT INFO

# Get function from functions library
. /lib/lsb/init-functions

# Start the service Doc Server
start() {
        su - nobody -c '/usr/bin/docserver -d /opt/docserver start'
}

# Stop the service Doc Server
stop() {
        /bin/fuser -k -n tcp 3456
}

### main logic ###
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        status docserver
        ;;
  restart|reload|condrestart)
        stop
        start
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|reload|status}"
        exit 1
esac

exit 0

